import request from '@/utils/request'

//导入查询重复数据
export function repeatData (data) {
  return request({
    url: '/lifelineDataMaintenance/getRepeatData',
    method: 'post',
    data: data,
  })
}

//导入生命线工程数据shp文件
export function uploadShp (data) {
  return request({
    url: '/lifelineDataMaintenance/uploadShp',
    method: 'post',
    data: data
  })
}

//导入生命线工程数据excel文件
export function uploadExcel (data) {
  return request({
    url: '/lifeline/uploadExcel',
    method: 'post',
    data: data
  })
}
// 导入建筑物表格数据
export function uploadBuildExcel(query) {
  return request({
    url: '/lifelineDataMaintenance/importHubBuilding',
    headers:{
      contentType:'multipart/form-data'
    },
    method: 'post',
    data: query
  })
}

// 查询版本信息
export function getVersionCode(params){
  return request({
    url: '/lifelineDataMaintenance/getVersionCode',
    method: 'get',
    params: params
  })
}

// 删除版本信息
export function deleteByTypeAndVersionId(params){
  return request({
    url: '/lifelineDataMaintenance/deleteByTypeAndVersionId',
    method: 'get',
    params: params
  })
}

//分页查询
export function queryByPage(params){
  return request({
    // url: '/lifeline/page',
    url:'/lifelineDataMaintenance/getByTypeAndVersionId',
    method: 'get',
    params: params
  })
}

//详情页
export function findById(id,type){
  let params = {
    id:id,
    type:type
  };
  return request({
    url: '/lifeline/findById',
    method: 'get',
    params: params
  })
}

//字典项查询
export function getValueByDictCodeAndKey(dictCode,key){
  let params = {
    dictCode:dictCode,
    key:key
  };

  return request({
    url: '/base/dicts/getValueByDictCodeAndKey',
    method: 'get',
    params: params
  })
}

//字典表查询
export function getValidDictItemsByDictCode(dictCode){
  let params = {
    dictCode:dictCode
  };

  return request({
    url: '/base/dicts/getValidDictItemsByDictCode',
    method: 'get',
    params: params
  })
}

//修改数据
export function updateData (data) {
  //map,type
  return request({
    url: '/lifelineDataMaintenance/updateById',
    method: 'post',
    data: data
  })
}

//删除数据
export function deleteData (data) {
  //map,type
  return request({
    url: '/lifelineDataMaintenance/deleteByTypeAndId',
    method: 'get',
    params: data
  })
}

//桥梁--删除数据
export function bridgeDeleteData (data) {
  //map:ids,flag
  return request({
    url: '/lifeline/bridgeDelete',
    method: 'post',
    data: data
  })
}

//桥梁--详情页
export function bridgeFindById(id,flag){
  let params = {
    id:id,
    flag:flag
  };
  return request({
    url: '/lifeline/bridgeFindById',
    method: 'get',
    params: params
  })
}
export function uploadFile(query) {
  return request({
    url: '/lifelineDataMaintenance/uploadFile',
    headers:{
		contentType:'multipart/form-data'
	},
    method: 'post',
    data: query
  })
}
// 上传矢量数据
export function uploadVectorData (data) {
  return request({
    url: '/lifelineDataMaintenance/uploadVectorData',
    method: 'post',
    data: data
  })
}
